{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1. Installation\n",
    "\n",
    "Three options are available to install NeuRec using the command line:\n",
    "\n",
    "* Pip;\n",
    "* Github repository;\n",
    "* Docker image.\n",
    "\n",
    "> The Docker image includes Jupyter notebooks.\n",
    "\n",
    "## Pip\n",
    "The easiest way to install NeuRec is to use Pip:\n",
    "\n",
    "1. Setup a virtual environment to handle the packages\n",
    "\n",
    "```bash\n",
    "python3 -m venv venv\n",
    "\n",
    "source venv/bin/activate\n",
    "```\n",
    "\n",
    "2. Install the NeuRec package:\n",
    "\n",
    "```bash\n",
    "pip3 install neurec\n",
    "```\n",
    "\n",
    "3. Import NeuRec into your project:\n",
    "\n",
    "```python\n",
    "import neurec\n",
    "```\n",
    "\n",
    "## Github\n",
    "NeuRec can be installed via Github in three steps:\n",
    "\n",
    "1. Clone the NeuRec Github repository to your local machine:\n",
    "\n",
    "  ```bash\n",
    "  git clone https://github.com/wubinzzu/NeuRec.git\n",
    "  \n",
    "  cd NeuRec\n",
    "  ```\n",
    "  \n",
    "2. Setup a virtual environment to handle the packages:\n",
    "\n",
    "    ```bash\n",
    "    python3 -m venv venv\n",
    "    \n",
    "    source venv/bin/activate\n",
    "    ```\n",
    "\n",
    "3. Finally, install the following required python packages:\n",
    "\n",
    "  * tensorflow 1.12.3\n",
    "  * numpy 1.16.4\n",
    "  * scipy 1.3.1\n",
    "  * importlib_resources 1.0.2\n",
    "  \n",
    "  ```bash\n",
    "  pip3 install -r requirements.txt\n",
    "  ```\n",
    "  \n",
    "  or\n",
    "  \n",
    "  ```bash\n",
    "  pip3 install tensorflow==1.12.3 numpy==1.16.4 scipy==1.3.1\n",
    "  ```\n",
    "  \n",
    "## Docker\n",
    "The NeuRec Docker image provides an alternative convenient way to using NeuRec. CPU and GPU options are available, which can be selected by stating either 'cpu' or 'gpu' as the image tag. The Docker Hub repository is [available here](https://hub.docker.com/r/jonathanstaniforth/neurec/).\n",
    "\n",
    "1. Pull the Docker image:\n",
    " \n",
    "  ```bash\n",
    "  docker pull jonathanstaniforth/neurec:<tag>\n",
    "  ```\n",
    "\n",
    "2. Run the image, mounting a folder of your choice into the container:\n",
    "\n",
    "  ```bash\n",
    "  docker run -p 8888:8888 -v (PWD)/data:/tf/data jonathanstaniforth/neurec:<tag>\n",
    "  ```\n",
    "  \n",
    "3. Connect to Juypter notebooks via a browser, and specifying the token:\n",
    "   \n",
    "   ```\n",
    "   http://127.0.0.1:8888?token=<token>\n",
    "   ```\n",
    "   \n",
    "   > The token for Jupyter notebooks is displayed on the command line after running the image."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.5rc1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
